package com.vincent.kdp.Activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.vincent.kdp.R;

import butterknife.ButterKnife;

/**
 * Created by jingjing on 2017/3/15.
 */

public abstract class BaseActivity extends Activity{

    private View contentView;
    private TextView title;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if(getLayOutId()==0){
            throw new IllegalArgumentException("请为界面指定布局");
        }
        contentView=View.inflate(this,getLayOutId(),null);

        setContentView(contentView);
        initView();
        if(isBufferKnife()){
            ButterKnife.bind(this);
        }
        title= (TextView) contentView.findViewById(R.id.toolbar_center_tv);
        title.setText(getToolTitle());

    }

    public abstract int getLayOutId();
    public abstract boolean isBufferKnife();
    public abstract String getToolTitle();
    public abstract void initView();


}
